# README
Author: ngoet

First version: 15.9.2018
This version: 13.07.2019

Replication materials for Goet, Fleming, and Zubek (2019), "Procedural Change in the UK House of Commons, 1811 - 2015"

## Setup, OS
Original code run on:

* MAC OSX 10.14
* 16 GB RAM
* 2.5 GHz, quad-core CPU

## Dependencies
The replication needs to be run from RStudio. The following `R` packages have to be installed for the code to run successfully:

* texreg
* xtable
* sandwich
* ggplot2
* pscl
* countreg
* stringr
* ngram
* stargazer
* lmtest
* arm
* zoo
* grid
* gridExtra
* DataCombine
* MASS

## Replication process and benchmarks
Prior to running the replication process, please unzip all folders in the repository. The folder structure needs to be maintained for the replication process to be successful. The complete replication can be achieved by running the `execute_replication.R` script. All output is saved in the subfolders under `output`, which are generated by the script. 

Each file, figure, and table generated by the code is logged in the ukhcso_logfile.log logfile. I recommend tailing the log file to keep track of progress.

Details of the individual scripts/codes and subfolder structure are provided in the sections below. 

Replication steps:
1. Unzip all compressed folders and files
2. Run the `runReplication.R` script from RStudio. 

Total replication time with the set-up and OS above is: 57.15 minutes.

Execution times for the subscripts executed by through `execute_replication.R` are as follows:

* `hurdleModelsAnalysis.R`: 1.28 minutes
* `genFiguresTables.R`: 55.87 minutes

## Folder structure
Contains the UK House of Commons Standing Orders dataset, in .xml, .json, and .csv formats (most recent versions will be available at [ParlRulesData.org](www.parlrulesdata.org):

* `ukhcso.csv`
* `ukhcso.json`
* `ukhcso.xml`

Also contains the data that is used in the empirical analysis (`uhcso_data.csv`), and a version of the UKHCSO dataset (`1811_2015.csv`) that is used to generate Figures 1 and 3. 


**Dependencies**:

* *genFiguresTables.R* generates all the figures and tables reported in the paper that are not part of the regression analysis.

* *hurdleModelsAnalysis.R* contains all code to replicate our regression analyses, including regression tables, coefficient plots, and our robustness analyses.
* calcClusteredSes.R [generate clustered SEs from hurdle model object]
* parlOutlierAnalysis.R [conducts our leave-one-parliament-out robustness analysis]
* robustnessPlot.R [generates robustness plots for our session- and parliament- robustness analyses]
* sessionOutlierAnalysis.R [conducts our leave-one-session-out robustness analysis]

**Output**:

* **figures**: all figures generated by *hurdleModelsAnalysis.R* and *genFiguresTables.R* are saved to this folder.

* **tables**: all tables generated by *genFiguresTables.R* as well as the regression tables generated by *hurdleModelsAnalysis.R* are saved to this folder. 

